import os
from process import exeControl
from robot import robot
from data import userData


if __name__ == '__main__':
    # 欢迎信息
    os.system("chcp 65001")  # linux下注释掉此项
    print("[DLS] 软件作者21Hertz,联系QQ2021583736")
    print("[DLS] 若有问题与建议可加群531241108反馈")
    print("[DLS] 输入命令dlsload可重新加载程序配置")
    dls_path = os.getcwd()
    # 实例化数据对象
    iniData = userData()
    # os.chdir("../bds")  # 打包时此项注释掉
    # 实例化dls-exe
    dls = exeControl(dls_path, iniData)
    dls.startAll()
    # 实例化dls-bot
    bot = robot(iniData, dls)
    bot.start()
    # 开始执行
    while True:
        command = input()
        if command == "stop":
            dls.stopAll()
            bot.stop()
            break
        elif command == "dlsload":
            iniData.reload()
            dls.iniReload(iniData)
            bot.iniReload(iniData)
        else:
            dls.executeCmd(command)

# 生成依赖 pipreqs ./ --encoding=utf8
# pyinstaller -F cli.py -i "logo.ico" --upx-dir "D:\ABCDEFG\Favorites\upx"
